<script setup>
import { getListBannerService } from '@/apis/list'
import { ref, onMounted } from 'vue'
// 存储轮播图
const bannerList = ref([])

// 获取轮播图
const getBannerList = async () => {
  const res = await getListBannerService()
  bannerList.value = res.data.carousels
}

onMounted(() => {
  getBannerList()
})
</script>

<template>
  <div class="banner">
    <el-carousel height="650px">
      <el-carousel-item v-for="item in bannerList" :key="item.id">
        <img :src="item.url" class="carousel-image" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<style scoped>
.banner {
  margin: 10px 0;

  .carousel-image {
    width: 100%;
    height: 100%;
  }
}
</style>
